using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using DAL;
using BUS;
using Utility;

public partial class Admin_LoaiSPUpdate : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData ();
        }
    }
    private void LoadData()
    {
     try 
     {
        int id = int.Parse (Request .QueryString ["id"].ToString ());
        tbLoaiSP lsp = tbLoaiSPBUS .GetByID (id);
         if (lsp!=null)
         {
             txt_malsp.Text =lsp.IDLoaiSP .ToString ();
             txt_tenlsp .Text =lsp.TenLoaiSP ;
         }
     }
        catch 
        {
            Response.Redirect("~/Admin/LoaiSPList.aspx");
        }
    }
    protected void btlsp_update_Click(object sender, EventArgs e)
    {
        tbLoaiSP lsp = new tbLoaiSP() ;
        lsp.IDLoaiSP =int.Parse (txt_malsp .Text );
        lsp.TenLoaiSP =txt_tenlsp .Text ;
        tbLoaiSPBUS .Update_LoaiSP (lsp);
        Response .Redirect ("~/Admin/LoaiSPList.aspx");
    }
}
